<template>
<!--  预上传必传字段设置-->
  <div class="app-container">
    <el-form ref="form"
             :model="form"
             :label-position="labelPosition"
             class="register-form">
      <el-row :gutter="60">
        <el-col :span="10">
          <el-row :gutter="20">
            <el-col :span="12">
              <el-form-item label="报告文号" :class="form.reportNo === '0' ? 'requiredMark' :''">
                <el-select v-model="form.reportNo" placeholder="请选择" disabled>
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="客户名称（被审验单位名称）" :class="form.customerName === '0' ? 'requiredMark' :''">
                <el-select v-model="form.customerName" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="客户营业执照号" :class="form.customerBusinessLicense === '0' ? 'requiredMark' :''">
                <el-select v-model="form.customerBusinessLicense" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
<!--            <el-col :span="12">-->
<!--              <el-form-item label="事务所行政区划" :class="form.administrativeDivision === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.administrativeDivision" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="12">-->
<!--              <el-form-item label="是否具有证券资格" :class="form.hasSecurities === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.hasSecurities" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
            <el-col :span="12">
              <el-form-item label="是否属于证券业务" :class="form.isSecuritiesBusiness === '0' ? 'requiredMark' :''">
                <el-select v-model="form.isSecuritiesBusiness" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="首次承接业务时间" :class="form.firstBusinessTime === '0' ? 'requiredMark' :''">
                <el-select v-model="form.firstBusinessTime" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="14">
          <el-row :gutter="20">
            <el-col :span="5">
              <el-form-item label="意见类型" :class="form.opinionType === '0' ? 'requiredMark' :''">
                <el-select v-model="form.opinionType" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="报备类型" :class="form.reportType === '0' ? 'requiredMark' :''">
                <el-select v-model="form.reportType" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="审计年度" :class="form.auditYear === '0' ? 'requiredMark' :''">
                <el-select v-model="form.auditYear" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="报告日期" :class="form.reportTime === '0' ? 'requiredMark' :''">
                <el-select v-model="form.reportTime" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
<!--          <el-row :gutter="20">-->
<!--            <el-col :span="5">-->
<!--              <el-form-item label="报备编码" :class="form.reportCode === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.reportCode" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->

<!--            <el-col :span="5">-->
<!--              <el-form-item label="报备年度" :class="form.filingYear === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.filingYear" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="5">-->
<!--              <el-form-item label="报备日期" :class="form.filingTime === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.filingTime" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="5">-->
<!--              <el-form-item label="报备状态" :class="form.reportStatus === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.reportStatus" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
          <el-row :gutter="20">

<!--            <el-col :span="5">-->
<!--              <el-form-item label="上传时间" :class="form.uploadTime === '0' ? 'requiredMark' :''">-->
<!--                <el-select v-model="form.uploadTime" placeholder="请选择">-->
<!--                  <el-option label="必填" value="0" />-->
<!--                  <el-option label="选填" value="1" />-->
<!--                </el-select>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
            <el-col :span="5">
              <el-form-item label="收费金额（元）" :class="form.chargeAmount === '0' ? 'requiredMark' :''">
                <el-select v-model="form.chargeAmount" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="验资金额（元）" :class="form.capitalVerificationAmount === '0' ? 'requiredMark' :''">
                <el-select v-model="form.capitalVerificationAmount" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5">
              <el-form-item label="验资币种" :class="form.capitalVerificationCurrency === '0' ? 'requiredMark' :''">
                <el-select v-model="form.capitalVerificationCurrency" placeholder="请选择">
                  <el-option label="必填" value="0" />
                  <el-option label="选填" value="1" />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="20">
            <div v-for="(item, index) in form.assuranceBusinessDataRegisterSignatures" :key="item.registerId" style="position: relative">
              <el-col :span="5">
                <el-form-item
                  :class="item.registrationCertificateNo === '0' ? 'requiredMark' :''"
                  :label="`签字注会${index+1}证书号`"
                  :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrationCertificateNo'"
                >
                  <el-select v-model="item.registrationCertificateNo" placeholder="请选择">
                    <el-option label="必填" value="0" />
                    <el-option label="选填" value="1" />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="5">
                <el-form-item
                  :class="item.registrantName === '0' ? 'requiredMark' :''"
                  :label="`签字注册会计师${index+1}`"
                  :prop="'assuranceBusinessDataRegisterSignatures.' + index + '.registrantName'"
                >
                  <el-select v-model="item.registrantName" placeholder="请选择">
                    <el-option label="必填" value="0" />
                    <el-option label="选填" value="1" />
                  </el-select>
                </el-form-item>
              </el-col>
            </div>
          </el-row>
        </el-col>
      </el-row>
      <el-form-item>
        <el-button
          :loading="loading"
          size="medium"
          type="primary"
          @click.native.prevent="handleSubmit"
        >
          <span v-if="!loading">保 存</span>
          <span v-else>保 存 中...</span>
        </el-button>
        <el-button
          size="medium"
          type="default"
          style="display:none;"
          @click.native.prevent="handleGoBack"
        >
          <span>返 回</span>
        </el-button>
      </el-form-item>

    </el-form>

  </div>
</template>
<script>
  import { preUploadConfig } from  "@/api/system/assurance";
  export default {
    name: "PreUpload",
    data() {
      return {
        labelPosition: "top",
        form: {},
        loading: false,
      };
    },
    created() {
      this.getForm();
    },
    methods: {
      getForm() {
        this.getConfigKey("office.preload.config").then(res=>{
          this.form = JSON.parse(res.msg);
        });
      },
      handleSubmit() {
        this.$confirm('此操作将提交预上传字段设置, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          /** 请求接口 */
          preUploadConfig(JSON.stringify(this.form)).then(res=>{
            this.$message({
              type: 'success',
              message: '设置成功!'
            });
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消设置'
          });
        });
      },
      handleGoBack() {
        this.$router.go(-1)
      }
    }
  };
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
  ::v-deep .el-form-item__label{
    position: relative;
    font-size: 15px;
  }
  ::v-deep .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before {
    content: '';  // 去掉 * 号
  }
  ::v-deep .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:after {
    content: '*';  // 后置 * 号
    color: #ff4949;
    margin-right: 4px;
    right: -15px;
    top: 2px;
    position: absolute;
  }
  ::v-deep .el-input__inner{
    &::-webkit-input-placeholder {
      font-size: 13px;
    }
  }
  ::v-deep .el-date-editor.el-input,::v-deep .el-select{
    width: 100%;
  }
  .requiredMark{
    ::v-deep .el-form-item__label:after {
      content: '*';  // 后置 * 号
      color: #ff4949;
      margin-right: 4px;
      right: -15px;
      top: 2px;
      position: absolute;
    }
  }
</style>
